﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Xml.Linq;
using System.Linq;

namespace ArmoryBrowser.Entities.Achievements
{
    public class AchievementsPage
    {
        #region Fields
        private TabInfo _tabInfoField;
        private CharacterInfo _characterInfoField;
        private Achievements _achievementsField;
        private String _globalSearchField;
        private String _langField;
        private String _requestUrlField;
        #endregion
        #region Properties
        public TabInfo TabInfo
        {
            get
            {
                return this._tabInfoField;
            }
            set
            {
                this._tabInfoField = value;
            }
        }
        public CharacterInfo CharacterInfo
        {
            get
            {
                return this._characterInfoField;
            }
            set
            {
                this._characterInfoField = value;
            }
        }
        public Achievements Achievements
        {
            get
            {
                return this._achievementsField;
            }
            set
            {
                this._achievementsField = value;
            }
        }
        public String GlobalSearch
        {
            get
            {
                return this._globalSearchField;
            }
            set
            {
                this._globalSearchField = value;
            }
        }
        public String Lang
        {
            get
            {
                return this._langField;
            }
            set
            {
                this._langField = value;
            }
        }
        public String RequestUrl
        {
            get
            {
                return this._requestUrlField;
            }
            set
            {
                this._requestUrlField = value;
            }
        }
        #endregion
        #region Constructor
        public AchievementsPage(XElement element)
        {
            GlobalSearch = element.GetAttributeValue("globalSearch");
            Lang = element.GetAttributeValue("lang");
            RequestUrl = element.GetAttributeValue("requestUrl");
            TabInfo = element.Elements("tabInfo").Select(e => new TabInfo(e)).FirstOrDefault();
            CharacterInfo = element.Elements("characterInfo").FirstOrDefault().Elements("character").Select(e => new CharacterInfo(e)).FirstOrDefault();
            Achievements = element.Elements("achievements").Select(e => new Achievements(e)).FirstOrDefault();
        }
        #endregion
    }
}
